package gjj.enums;

import java.util.Arrays;

public enum ImgLabel {
    PHOTO("photo", 1, "image"),
    WESTERN("western", 2, "image"),
    TISSUE("tissue", 3, "image"),
    BRIGHT_FIELD("bright_field", 4, "image"),
    FLUORESCENT("fluorescent", 5, "image"),
    SCATTER("scater", 6, "plot"),
    CHIP("chip", 7, "plot"),
    CHART("chart", 8, "graph"),
    ILLUSTRATE("illustrate", 9, "graph"),
    TEXT("text", 10, "label"),
    ICON("icon", 11, "label"),
    ;

    private final String name;
    private final int label;
    private final String type;

    ImgLabel(String name, int label, String type) {
        this.name = name;
        this.label = label;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public int getLabel() {
        return label;
    }

    public String getType() {
        return type;
    }

    public static ImgLabel getByLabel(Integer label) {
        if (null == label) return TEXT;
        return Arrays.stream(ImgLabel.values()).filter(e -> e.getLabel() == label).findFirst().orElse(TEXT);
    }
}
